import { getRoutes, setRoutes } from '@/utils/session'
import { defineStore } from 'pinia'

export interface PermissionState {
  routes: Array<[]>
}

export const usePermissionStore = defineStore('permission', {
  state (): PermissionState {
    return {
      routes: getRoutes()
    }
  },

  actions: {
    SetRoutes (routes: Array<[]>) {
      setRoutes(routes)
      this.routes = routes
    }
  }
})
